<?php echo $this->render('grid_header.phtml') ?>

<table class="data-grid">
    <thead>
        <tr>
            <th class="br" style="width: 35px">

    <div class="sort-column">
        <span class="sort-label fl">ID</span>
        <div class="sort fr">
            <span class="asc fieldNameid" ></span>
            <span class="desc fieldNameid"></span>
        </div>
        <div class="cls"></div>
    </div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Login</span>
    <div class="sort fr">
        <span class="asc fieldNamelogin" ></span>
        <span class="desc fieldNamelogin"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">E-mail</span>
    <div class="sort fr">
        <span class="asc fieldNameemail" ></span>
        <span class="desc fieldNameemail"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Dołączył</span>
    <div class="sort fr">
        <span class="asc fieldNamecreated" ></span>
        <span class="desc fieldNamecreated"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Logowanie</span>
    <div class="sort fr">
        <span class="asc fieldNamelastLogin" ></span>
        <span class="desc fieldNamelastLogin"></span>
    </div>
    <div class="cls"></div>
</div>
</th>

<th class="br">
<div class="sort-column">
    <span class="sort-label fl">Status</span>
    <div class="sort fr">
        <span class="asc fieldNamestatus" ></span>
        <span class="desc fieldNamestatus"></span>
    </div>
    <div class="cls"></div>
</div>
</th>
<th>
    <span class="sort-column">Akcja</span><br>
    <span class="hidden-data">{"filterUrl":"/admin/index/users"}</span>
    <a class="ajaxFilter" href="javascript:void(0);">Filtruj</a>
    <a class="ajaxFilterClear" href="javascript:void(0);">Wyczyść</a>                
</th>
</tr>
<tr>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filterid" class="filterField" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['id'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filterlogin" class="filterField" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['login'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filteremail" class="filterField" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['email'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filtercreatedod" class="filterField datepicker" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['createdod'] ?>"}</span>
        </div>
        <div class="ui-filter">
            <input type="text" name="filtercreateddo" class="filterField datepicker" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['createddo'] ?>"}</span>
        </div>
    </td>
    <td class="br">
        <div class="ui-filter">
            <input type="text" name="filterlastod" class="filterField datepicker" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['lastod'] ?>"}</span>
        </div>
        <div class="ui-filter">
            <input type="text" name="filterlastdo" class="filterField datepicker" />
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['lastdo'] ?>"}</span>
        </div>
    </td>
    
    <td class="br">
        <div class="ui-filter">
            <select name="filterstatus" class="filterField">
                <option label="-----" value="-1" >-----</option>
                <option label="aktywny" value="1" >aktywny</option>
                <option label="nie aktywny" value="0" >nie aktywny</option>
            </select>
            <span class="hidden-data ui-filter-value">{"value":"<?php echo $this->wparams['status'] ?>"}</span>
        </div>
    </td>
    <td>

    </td>
</tr>
</thead>
<tbody>
    <?php if (count($this->paginator)): ?>
        <?php foreach ($this->paginator as $idx => $item): ?>
            <tr class="item-<?php echo $idx ?>">
                <td class="br" ><?php echo $item['userId'] ?></td>
                <td class="br">
                    <a class="default" href="<?php echo $this->url(array('module' => 'admin', 'action' => 'useredit', 'id' => $item['userId']), null, true) ?>">
                        <?php echo $item['login'] ?>
                    </a>
                </td>
                <td class="br"><?php echo $item['email'].''.($item['name']!=""?'<br>[ '.$item['name'].' ]':'').'' ?></td>
                <td class="br"><?php echo $item['created'] ?></td>
                <td class="br"><?php echo $item['lastLogin'] ?></td>
               
                <td class="br">
                    <span><?php echo $item['active'] == 0 ? 'nie aktywny' : 'aktywny' ?></span>
                    <a rel="<?php echo $item['userId'] ?>" class="ajax-post" href="<?php echo $this->url(array('module' => 'admin', 'action' => 'setmodel', 'id' => $item['userId'], 'table' => 'users'), null, true) ?>"><?php echo $item['active'] == 0 ? 'Odblokuj' : 'Blokuj' ?></a>
                    <div id="ajx-pdata-<?php echo $item['userId'] ?>" class="ajax-post-data"><?php echo Zend_Json::encode(array('active' => $item['active'] == 0 ? 1 : 0)) ?></div>
                </td>
                <td >
                    <a rel="<?php echo $item['userId'] ?>d" class="ajax-post" href="<?php echo $this->url(array('module' => 'admin', 'action' => 'setmodel', 'id' => $item['userId'], 'table' => 'users'), null, true) ?>">Usuń</a>
                    <div id="ajx-pdata-<?php echo $item['userId'] ?>d" class="ajax-post-data"><?php echo Zend_Json::encode(array('deleted' => 1)) ?></div>
                    <!--<a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'useredit', 'id' => $item['userId']), null, true) ?>">Edytuj</a>-->
                    <!--<a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'useradd'), null, true) ?>">Dodaj</a>-->
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif; ?>
</tbody>
<tfoot>
    <tr>
        <td colspan="9">
            <?php
            echo $this->paginationControl($this->paginator, 'Sliding', 'pg_nav01.phtml');
            ?>
        </td>
    </tr>
</tfoot>
</table>
